package com.heima.wemedia.feign;

import com.heima.client.wemedia.IWmChannelClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.WmChannelDto;
import com.heima.wemedia.service.WmChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@RestController
@Slf4j
public class WmChannelClient implements IWmChannelClient {
    @Autowired
    private WmChannelService wmChannelService;
    @PostMapping("/save")
    @Override
    public ResponseResult saveChannel(@RequestBody WmChannelDto channelDto){
        return wmChannelService.saveChannel(channelDto);
    }
    @PostMapping("/list")
    public ResponseResult pageQuery(@RequestBody WmChannelDto channelDto) {
        return wmChannelService.pageQuery(channelDto);
    }
    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody WmChannelDto channelDto) {
        log.info("传入参数为：{}",channelDto);
        return wmChannelService.upate(channelDto);
    }
    @PostMapping("/del")
    @Override
    public ResponseResult deleteChannel(Integer id) {
        log.info("传入参数为：{}",id);
        return wmChannelService.deleteChannel(id);
    }
}